package com.candy.inner;

/**
 * @author donglin
 * @Title:
 * @类名: Student
 * @date 2020/5/22
 */
public class Student {
    //属性
    private int stuNo;
    private String stuName;
    private boolean sex;

    //创建成员内部类
    public class Game{
        public void doSometing(){
            System.out.println("打排位，我是成员内部类");
        }

    }

    public Student() {
    }
    //构造
    public Student(int stuNo, String stuName, boolean sex) {
        this.stuNo = stuNo;
        this.stuName = stuName;
        this.sex = sex;
    }
    //方法
    public void studing(){
        System.out.println("我在学习");
        Game g1=new Game();
        g1.doSometing();
    }
    public void eatting(){
        //局部内部类
         class Sleep{
            void doSometing(){
                System.out.println("我是局部内部类");
            }
        }
        System.out.println("我在吃饭");

         Sleep sleep=new Sleep();
         sleep.doSometing();


    }
    public void playing(){
        System.out.println("我在打游戏");
        //匿名内部类
        new Team() {
            @Override
            public void playGame() {
                System.out.println("打豆豆，我是匿名内部类");
            }
        }.playGame();

    }

}
